create or replace view vac_page_item_4_1 as
with pi as
(
 select
  workspace,
  application_id,
  application_name,
  page_id,
  page_name,
  item_name,
  display_as,
  display_as_code,
  item_data_type,
  is_required,
  standard_validations,
  to_char(display_sequence) display_sequence,
  region,
  source_used,
  item_default,
  item_default_type,
  label,
  pre_element_text,
  post_element_text,
  format_mask,
  item_label_template,
  item_source,
  item_source_type,
  encrypt_session_state,
  source_post_computation,
  read_only_condition_type,
  read_only_condition_exp1,
  read_only_condition_exp2,
  read_only_display_attr,
  lov_named_lov,
  lov_definition,
  lov_display_extra,
  lov_display_null,
  lov_null_text,
  lov_null_value,
  lov_query_result_translated,
  lov_cascade_parent_items,
  ajax_items_to_submit,
  ajax_optimize_refresh,
  to_char(item_element_width)  item_element_width,
  to_char(item_element_max_length) item_element_max_length,
  to_char(item_element_height) item_element_height,
  html_table_cell_attr_label,
  html_table_cell_attr_element,
  html_form_element_attributes,
  form_element_option_attributes,
  item_button_image,
  item_button_image_attributes,
  begins_on_new_row,
  begins_on_new_cell,
  to_char(column_span) column_span,
  to_char(row_span) row_span,
  label_alignment,
  item_alignment,
  show_quick_picks,
  quick_pick_link_attr,
  quick_pick_label_01, quick_pick_value_01,   quick_pick_label_02,   quick_pick_value_02,
  quick_pick_label_03, quick_pick_value_03,   quick_pick_label_04,   quick_pick_value_04,
  quick_pick_label_05, quick_pick_value_05,   quick_pick_label_06,   quick_pick_value_06,
  quick_pick_label_07, quick_pick_value_07,   quick_pick_label_08,   quick_pick_value_08,
  quick_pick_label_09, quick_pick_value_09,   quick_pick_label_10,   quick_pick_value_10,
  attribute_01,   attribute_02,   attribute_03,   attribute_04,   attribute_05,
  attribute_06,   attribute_07,   attribute_08,   attribute_09,   attribute_10,
  condition_type,   condition_expression1,   condition_expression2,
  maintain_session_state,
  item_protection_level,
  escape_on_http_output,
  authorization_scheme,
  build_option,
  item_help_text,
  last_updated_by,
  component_comment,
  item_id
from apex_application_page_items
)
select   workspace,
         application_id,
         application_name,
         page_id,
         page_name,
         item_name,
         item_id,
         last_updated_by,
         lov_definition,
         U_NAME,
         U_VALUE,
         'APEX_APPLICATION_PAGE_ITEMS' src_view_name
from pi
UNPIVOT INCLUDE NULLS
 (
   u_value
   FOR    u_name
   IN
   (      display_as,
  display_as_code,
  item_data_type,
  is_required,
  standard_validations,
  display_sequence,
  region,
  source_used,
  item_default,
  item_default_type,
  label,
  pre_element_text,
  post_element_text,
  format_mask,
  item_label_template,
  item_source,
  item_source_type,
  encrypt_session_state,
  source_post_computation,
  read_only_condition_type,
  read_only_condition_exp1,
  read_only_condition_exp2,
  read_only_display_attr,
  lov_named_lov,
  lov_display_extra,
  lov_display_null,
  lov_null_text,
  lov_null_value,
  lov_query_result_translated,
  lov_cascade_parent_items,
  ajax_items_to_submit,
  ajax_optimize_refresh,
  item_element_width,
  item_element_max_length,
  item_element_height,
  html_table_cell_attr_label,
  html_table_cell_attr_element,
  html_form_element_attributes,
  form_element_option_attributes,
  item_button_image,
  item_button_image_attributes,
  begins_on_new_row,
  begins_on_new_cell,
  column_span,
  row_span,
  label_alignment,
  item_alignment,
  show_quick_picks,
  quick_pick_link_attr,
  quick_pick_label_01, quick_pick_value_01,   quick_pick_label_02,   quick_pick_value_02,
  quick_pick_label_03, quick_pick_value_03,   quick_pick_label_04,   quick_pick_value_04,
  quick_pick_label_05, quick_pick_value_05,   quick_pick_label_06,   quick_pick_value_06,
  quick_pick_label_07, quick_pick_value_07,   quick_pick_label_08,   quick_pick_value_08,
  quick_pick_label_09, quick_pick_value_09,   quick_pick_label_10,   quick_pick_value_10,
  attribute_01,   attribute_02,   attribute_03,   attribute_04,   attribute_05,
  attribute_06,   attribute_07,   attribute_08,   attribute_09,   attribute_10,
  condition_type,
  condition_expression1,
  condition_expression2,
  maintain_session_state,
  item_protection_level,
  escape_on_http_output,
  authorization_scheme,
  build_option,
  item_help_text,
--  last_updated_by,
  component_comment
 )
);

